﻿using System;
using Dragablz;
using Prism.Navigation.Regions;

namespace Prism.Dragablz.Extensions.Regions;

public class TabablzControlRegionAdapter : RegionAdapterBase<TabablzControl>
{
    public TabablzControlRegionAdapter(IRegionBehaviorFactory regionBehaviorFactory)
      : base(regionBehaviorFactory)
    {
    }

    protected override void Adapt(IRegion region, TabablzControl regionTarget)
    {
    }

    protected override IRegion CreateRegion()
    {
        return new TabablzControlRegion();
    }

    protected override void AttachBehaviors(IRegion region, TabablzControl regionTarget)
    {
        if (region == null) ArgumentNullException.ThrowIfNull(region);
        region.Behaviors.Add(TabablzControlBehavior.s_behaviorKey, new TabablzControlBehavior() { HostControl = regionTarget });
        base.AttachBehaviors(region, regionTarget);
    }
}
